
ActionInfo = (function() {
	var layerIndex=0;
	function search() {
		
	};
	
	function clear() {
		
	};

	function loadWarrType(){
		MyAjax.post(ctx+"/sys/dict/getDict", {type : "I3_WARR_TYPE"}, function(json, error) {
			if (error || !json.data || json.data.length == 0) {
				return;
			}
			putSelectData($("#warrType"),json.data,"",1);
		});
	};
	function loadSaleNo(){
		MyAjax.post(ctx+"/sys/dict/getDict", {type : "SALENO"}, function(json, error) {
			if (error || !json.data || json.data.length == 0) {
				return;
			}
			putSelectData($("#saleNo"),json.data,"",1);
		});
	};
	function putSelectData(obj,item,defVal,isNotSel){
		obj.empty();
		if(isNotSel){
			obj.append(new Option("",""));
		}
		for (var  i = 0; i < item.length; i ++) {
			var opt = new Option(item[i].value+" "+item[i].label,item[i].value);
			if (null != defVal && item[i].value == defVal) {
				opt.selected = true;
			}
			obj.append(opt);
		}
	};


	function initLoad(){
		loadNtCode();//国籍
		loadNation();//民族
		loadIdType();//证件类型
		//loadProv();//省份
		loadGstFrom();//客源
		loadGstType();//客类
		loadTflag();//入住类型
		loadWarrType();//担保类型
		loadSaleNo();//锁售员

	};

	function addEvent() {


		$('#ddateBind').datetimepicker({
			format: "YYYY-MM-DD HH:mm:ss",
			stepping:30
		});
		$('#gstBdateBind').datetimepicker({
			format: "YYYY-MM-DD"
		});
		$('#gstVisaInDateBind').datetimepicker({
			format: "YYYY-MM-DD"
		});
		$('#gstVisaExpireBind').datetimepicker({
			format: "YYYY-MM-DD"
		});
		$('#leftDayBind').spinner('changed', function(e, newVal, oldVal) {
			getLeftDay();getChangeRrms();
		});
		$("#ddate").bind("blur",function(){getDdate();getChangeRrms();});
		$("#leftDay").bind("blur",function(){getLeftDay();getChangeRrms();});


		$("#readIDCard").bind("click",function(){doGstType();getChangeNprice();});
		$("#readIDCardBtn").bind("click",function(){doReadIdCard();});
		$("#saveButton").bind("click",function(){doSaveNext();});
	};
	function init() {
		clear();
		initLoad();
		addEvent();
		search();
	};
	
	return {
		load : init
	};
})();

$(document).ready(function() {
	ActionInfo.load();
});
